package com.anivia.system.auth.model.entity;

import com.anivia.common.core.enums.DataScopeEnum;
import com.anivia.common.web.config.mybatisPlus.typeHandler.IntListToStringTypeHandler;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 租户-资源关系表
 * </p>
 *
 * @author wangj
 * @since 2024-04-03
 */
@Getter
@Setter
@TableName(value = "role_resource_info", autoResultMap = true)
public class RoleResourceInfoDO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 角色id
     */
    private Integer roleId;
    /**
     * 资源id
     */
    private Integer resourceId;
    /**
     * 租户id
     */
    private Integer tenantId;

    /**
     * 数据权限范围
     */
    private DataScopeEnum dataScope;

    /**
     * 数据权限范围为自定义部门时，部门id集合
     */
    @TableField(typeHandler = IntListToStringTypeHandler.class)
    private List<Integer> customDeptIds;
}
